//
//  ParentHistoryViewController.m
//  WheatPlan
//
//  Created by 王晨辉 on 15/5/29.
//  Copyright (c) 2015年 IOSTeam. All rights reserved.
//

#import "ParentHistoryViewController.h"
#import "EMyTeacherViewController.h"
@interface ParentHistoryViewController ()

@end

@implementation ParentHistoryViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    //设置导航栏头文字
    self.navigationItem.title = @"敏感期捕捉报告";
    //设置导航栏背景颜色
    [self.navigationController.navigationBar setBarTintColor:[GetFileModel colorWithHexString:@"#44afd7" alpha:1]];
    //设置导航栏字体颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    //自定义左右按钮
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:[UIImage imageNamed:@"_0000_返回.png"]
                      forState:UIControlStateNormal];
    [button addTarget:self action:@selector(turntolast)
     forControlEvents:UIControlEventTouchUpInside];
    button.frame = CGRectMake(0, 0, 20, 15);
    
    UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.navigationItem.leftBarButtonItem = menuButton;
    

    [self subView];
    
}
-(void)turntolast{
    
    [self dismissViewControllerAnimated:YES completion:nil];
}
-(void)subView{
    
    
    
    _ParentHistoryTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain];
    _ParentHistoryTableView.delegate = self;
    _ParentHistoryTableView.dataSource = self;
    _ParentHistoryTableView.rowHeight = 52;
    _ParentHistoryTableView.tableFooterView=[[UIView alloc]init];
    [self.view addSubview:_ParentHistoryTableView];
    
    
    
}
#pragma mark--- tableViewDelegate 每个区的行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return nameArray.count;
}

#pragma mark--- tableViewDelegate 区尾的高度

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 0;
    
}
#pragma mark--- tableViewDelegate cell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *NOTIFY = @"cell";
    UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:NOTIFY];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NOTIFY];
        
    
    _ParentHistoryTableView.separatorStyle = UITableViewCellEditingStyleNone;
    
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, _ParentHistoryTableView.rowHeight-1, SCREEN_WIDTH, 1)];
    view.backgroundColor = UIColorWithRGBA(229, 229, 231, 1);
    [cell addSubview:view];
    
     NSArray * imageName = [[NSArray alloc]initWithObjects:@"报告_本体感测评@2x.png.png",@"报告_触感测评@2x.png.png",@"报告_平衡感测评@2x.png.png",@"报告_前庭觉测评@2x.png.png",@"报告_视知觉测评@2x.png.png",@"报告_听知觉测评@2x.png.png", nil];
    
    UIImageView * image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 6, 43, 42)];
    image.image = [UIImage imageNamed:[imageName objectAtIndex:indexPath.row]];
    [cell addSubview:image];

    
    _nsArry = [[NSArray  alloc] initWithObjects:@"           本体感测评报告", @"           触感测评报告", @"           平衡感测评报告", @"           前庭感测评报告", @"           视知觉测评报告", @"           听知觉测评报告",nil];
    [[cell textLabel]  setText:[_nsArry objectAtIndex:indexPath.row]];

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        
        
        
    }
    


    
    

    
    
    return cell;
    
    
}
#pragma mark--- tableViewDelegate 有几个区
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
    
}
#pragma mark--- tableViewDelegat 点击方法
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    EMyTeacherViewController * doorVC = [[EMyTeacherViewController alloc]init];
    UINavigationController * nav = [[UINavigationController alloc]initWithRootViewController:doorVC];
    [self presentViewController:nav animated:YES completion:nil];
    
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
